<template>
  <div>
    <el-container>
      <el-aside width="200px">
        <el-menu
          default-active="1-1"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
        >
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>蔬菜管理</span>
            </template>
            <el-menu-item index="1-1" @click="clickMenu(11)"
              >清单列表</el-menu-item
            >
            <!-- <el-menu-item index="1-2" @click="clickMenu(12)"
              >子菜单2</el-menu-item
            > -->
          </el-submenu>
          <el-menu-item index="2">
            <i class="el-icon-menu"></i>
            <span slot="title">待开发</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>蔬菜管理系统</el-header>
        <el-main><router-view /></el-main>
        <!-- <el-footer>版权</el-footer> -->
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  name: "mainBase",
  data() {
    return {};
  },
  created() {
    this.$router.push({ path: "/mainPage" });
  },
  components: {},
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    // 点击菜单
    clickMenu(n) {
      if (n == 11) {
        this.$router.push({ path: "/mainPage" });
      } else if (n == 12) {
        this.$router.push({ path: "/default" });
      }
    },
  },
};
</script>

<style scoped>
.el-header,
.el-footer {
  background-color: #c2d0df;
  color: #333;
  text-align: center;
  line-height: 40px;
  height: 40px !important;
}

.el-aside {
  background-color: #ffffff;
  color: #333;
  text-align: center;
  line-height: 200px;
  height: 100vh;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  /* line-height: 160px; */
}

/* body > .el-container {
  height: calc(100vh - 40px);
} */

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>